.chat-item {
  position: relative;
  display: flex;
  width: 100%;
  padding-bottom: 20px;

  &-avatar {
    width: 40px;
    height: 40px;

    img {
      width: 100%;
      height: 100%;
      cursor: pointer;
      user-select: none;
      border-radius: 50%;
      -webkit-user-drag: none;
    }
  }

  &-box {
    flex: 1;
    padding: 0 12px;
  }

  &-user-info {
    display: flex;
    column-gap: 4px;
    align-items: center;
    margin-bottom: 8px;
    font-size: 12px;
    color: var(--font-light);
    white-space: nowrap;

    .user-name:hover {
      color: var(--color-primary);
      cursor: pointer;
    }

    .user-badge {
      width: 18px;
      height: 18px;
      cursor: pointer;
      user-select: none;
    }

    .user-ip {
      user-select: none;
    }

    .send-time {
      display: inline-block;
      user-select: none;
      opacity: 0;
    }
  }

  &-content {
    position: relative;
    width: fit-content;
    min-height: 1em;
    padding: 8px 12px;
    font-size: 15px;
    line-height: 22px;
    color: var(--font-main);
    word-break: break-word;
    white-space: pre-line;
    background-color: var(--background-2);
    border-radius: 2px 18px 18px;
  }

  &-option {
    position: absolute;

    // display: none;
    top: -20px;
    right: 0;
    z-index: 999;
  }

  &-reply {
    display: flex;
    align-items: center;
    width: fit-content;
    padding: 4px 12px;
    margin-top: 4px;
    margin-right: auto;
    overflow: hidden;
    font-size: 12px;
    color: var(--font-light);
    word-break: break-all;
    background-color: var(--background-3);
    border-radius: 8px;

    &.pointer {
      cursor: pointer;
    }

    .ellipsis {
      display: -webkit-inline-box;
      text-overflow: ellipsis;
      -webkit-line-clamp: 4;
      -webkit-box-orient: vertical;
    }
  }

  .extra {
    width: fit-content;
    margin-top: 4px;
    user-select: none !important;

    &-item {
      display: inline-flex;
      align-items: center;
      padding: 0 6px;
      margin-right: 4px;
      cursor: pointer;
      background-color: var(--border-1);
      border: 1px solid var(--border-base);
      border-radius: 8px;

      svg {
        width: 20px;
        height: 20px;
        transition: transform 0.2s;
      }

      .count {
        margin: 0 4px 0 2px;
        font-size: 12px;
      }

      &:hover {
        svg {
          transform: scale(1.2);
        }

        &.dlike svg {
          transform: scale(0.9);
        }
      }
    }

    .active {
      &.like {
        color: var(--font-pink);
        border-color: var(--border-pink);
      }

      &.dlike {
        color: var(--font-light);
        border-color: var(--el-color-info);
      }
    }
  }
}

.right {
  flex-direction: row-reverse;

  .chat-item-user-info {
    justify-content: flex-end;

    .send-time {
      order: 0;
    }

    .user-badge {
      order: 1;
    }

    .user-name {
      order: 2;
    }

    .user-ip {
      order: 3;
    }
  }

  .chat-item-content {
    margin-left: auto;
    border-radius: 18px 2px 18px 18px;
  }

  .extra,
  .chat-item-reply {
    margin-right: 0;
    margin-left: auto;
  }
}

.chat-item:hover {
  .send-time {
    display: inline-block;
    opacity: 1;
    transition: opacity 0.3s 1s;
  }

  .chat-item-option {
    display: inline-flex;
  }
}

.send-time-block {
  display: inline-block;
  width: 100%;
  margin-bottom: 12px;
  font-size: 12px;
  color: var(--font-light);
  text-align: center;
  user-select: none;
}

.is-me .chat-item-content {
  background-color: var(--color-primary);
}

.can-scroll-icon {
  display: inline-block;
  width: 12px;
  min-width: 12px;
  height: 12px;
  margin-right: 4px;
  background-image: url('@/assets/operate-icons/to_top.svg');
  background-position: center;
  background-size: contain;
}

.fade-enter-leave,
.fade-enter-active {
  animation: fade 0.5s;
}

@keyframes fade {
  0% {
    transform: translateY(100%);
  }

  100% {
    transform: translateY(0);
  }
}

.count-up-enter-active,
.count-up-leave-active {
  transition: all 0.25s ease-out;
}

.count-up-enter-from {
  opacity: 0;
  transform: translateY(5px);
}

.count-up-leave-to {
  opacity: 0;
  transform: translateY(-5px);
}

.remove-enter-active,
.remove-leave-active {
  transition: opacity 0.12s, transform 0.12s, height 0.12s;
}

.remove-leave-to {
  height: 14px; // 防抖动的核心，与send-time-block真实高度一致
  opacity: 0;
  transform: scale(0);
}
